<%@page import="cn.sendto.dbhelper.DBHelper"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
    <%
   if(request.getSession().getAttribute("user")==null){
	   request.getRequestDispatcher("login.jsp").forward(request, response);
   }

%>
    <% 
       request.setCharacterEncoding("utf-8");
       String studentId=request.getParameter("studentid");
       String courseId=request.getParameter("courseid");
       String score=request.getParameter("score");
       DBHelper helper=new DBHelper();
       final String INSERT="insert into scoreinfo (score,courseid,studentid) values (?,?,?)";
       int returnValue=helper.executeInsert(INSERT,score,courseId,studentId);
       helper.close();
       if(returnValue==0){
    	   %>
    	   <script>
    	   alert("添加失败，请重试！");
    	   window.location.href="addscore.jsp?id="+courseId;
    	   </script>
    	   <%
       } else{
    	   %>
    	   <script>
    	   alert("添加成功！");
    	   window.location.href="course_info.jsp";
    	   </script>
    	   <%
       }
    %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
</head>
<body>

</body>
</html>